package com.wnxy.e_rpc;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class Server {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "queue-rpc"),
            exchange = @Exchange(name = "exchange-rpc",type = ExchangeTypes.TOPIC),
            key = "rpc.#"
    ))
    public String handlerMsg(String msg) {
        System.out.println("服务端获取数据："+msg);
        return "服务端返回数据";
    }
}
